<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>添加分类 - 文章管理 - 我的后台管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="__STATIC__/layui/css/layui.css" />
	<link rel="stylesheet" href="__CSS__/iconfont.css">
	<link rel="stylesheet" href="__CSS__/common.css">
</head>
<body class="childrenBody">
	
	<div class="breadcrum">
		<div class="navgat">
			<h3>
				<a href="javascript:;" class=""><i class="iconfont">&#xe641;</i></a>
				<span>&gt;</span>
				<a href="javascript:;" class="">文章管理</a>
				<span>&gt;</span>
				<a href="javascript:;" class="">添加分类</a>
			</h3>
		</div>
		<div class="refresh">
			<div class="layui-btn-group">
				<a onclick="location.reload();" class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe669;</i></a>
				<a onclick="history.back();" class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe65c;</i></a>
			</div>
		</div>
	</div>	
	<div class="main">
		<form class="layui-form" style="width:40%;" id="form_data">
			
			<div class="layui-form-item">
				<label class="layui-form-label">分类名称</label>
				<div class="layui-input-inline">
					<input type="text" name="name" class="layui-input" lay-verify="required" placeholder="分类名称">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">使用状态</label>
				<div class="layui-input-block">
					<input type="checkbox" name="status" value="1" title="是否启用" checked>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="button" class="layui-btn" lay-submit lay-filter="go">立即提交</button>
					<button type="reset"  class="layui-btn layui-btn-primary">重置</button>
			    </div>
			</div>
		</form>
	</div>

	<script type="text/javascript" src="__STATIC__/layui/layui.js"></script>
	<script type="text/javascript" src="__JS__/jquery.min.js"></script>
	<script type="text/javascript">
		
		layui.use(['form','layer'],function(){
			var form  = layui.form,
				layer = layui.layer,
				$ = layui.$;

		 	// 提交数据
			form.on('submit(go)', function(res){
		 		var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.2});
		        // 序列化表单数据
				var form_data = $("#form_data").serialize();
				$.ajax({
					type: "POST",
			        url:"/admin/news/edit_class?flag=add",
					data:form_data,
					dataType:'json',
			        success: function(data){
		            	top.layer.close(index);
		            	
			        	if(data.status == -1){
			        		layer.alert(data.msg, {icon: 2});
			        	}else{
			        		layer.msg(data.msg, {icon: 1});
			        	}
			        }
				})
			})

		})

	</script>
</body>
</html>